<?php
########################################################
# DMS Donations Management System v1.0                 #
# created by:  Isaac Sabas                             #
#			   Nikko Reyes							   #
#			   Miko Tiamwatt						   #
#                                                      #
# De La Salle Philippines                              #
# All Rights Reserved DLSP Copyright 2009              #
########################################################

# INFORMATION:
# dashboard_ticket_window.php 
# 	- this script is responsible for the handling of data for the ticket window
# 	
#	the script has two (2) modes:
#		- display - gets the data from the database using DataHandle.php class
#		- ticket form processing - provides error checking and validation before submitting information to the database using DBHandle.php class
#

define('START', true);	

session_start();	
	
#############################	
# set error checking levels #
#############################			
# enable these lines when site is to be deployed #	
	ini_set('error_reporting', E_ALL);
    ini_set('display_errors', 'On');
    //ini_set('log_errors', 'On');
    //ini_set('error_log', '/usr/local/apache/logs/error_log');
	
#############################
# include some needed files #
#############################
	# include some needed files #
	$absRoot = '../../';
	include($absRoot . 'lib/PEAR/PEAR/Sigma.php');	
	include($absRoot . 'lib/XAJAX/xajax_core/xajax.inc.php');
	
##################################	
# instantiate predifined classes #
##################################
	$template = new HTML_Template_Sigma($absRoot . 'templates', 'templates-cache');												
	//$xajax = new xajax();				
	
###########################################################	
# register all functions to be handled by XAJAX framework #
###########################################################
	/*function echo_ajaxtest($text) {
		$objResponse = new xajaxResponse();
					
		$objResponse->addAssign("_ajaxtest.response","innerHTML", $text);				
		
		return $objResponse;
	}

	$xajax->registerFunction("echo_ajaxtest");
	*/
##################
# page variables #
##################	
	$page_title = 'De La Salle University | Donations Management System ';
	$css = 'css/index.css';
	//$xajax_directives = $xajax->getJavascriptConfig() . $xajax->getJavascriptInclude('lib/XAJAX/');										

###########################
# load template to buffer #
###########################

	if (isset($_GET['ticket_id'])){
		$window = (int) $_GET['ticket_id'];
	}
	else {
		$window = 0;
	}
	
	switch($window) {
		case 0:
			$template->loadTemplateFile('windows/ticketNew.html');						
		break;
		case 1:
			$template->loadTemplateFile('dashboard/ticket_review.html');						
			$template->setVariable('CLIENT_NAME', 'Isaac Sabas');
			$template->setVariable('TICKET_CREATED', '11:18AM 04/14/09');
			$template->setVariable('CALL_STATUS', 'Success');
			$template->setVariable('CLIENT_STATUS', 'For Follow-up');
			$template->setVariable('TICKET_STATUS', 'Closed');			
			$template->setVariable('FOLLOWUP_DATE', '04/14/09');
			$template->setVariable('FOLLOWUP_TIME', '11:18AM');
			$template->setVariable('DONATED_AMOUNT', '200');
			$template->setVariable('DONATION_METHOD', 'Cash');
			$template->setVariable('DONATION_PICKUP_DATES', '04/14/09');
			$template->setVariable('NOTES', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.');			
		break;				
		default:
			$template->loadTemplateFile('windows/notificationError.html');
	}

#########################################
# index page template processor section #
#########################################																							
	
########################	
# login logout section #		
########################

############################			
# privelage filter section #
############################

	#########################					
	# page processor engine #			
	#########################
	
##########################	
# set template variables #
##########################	
	$template->setVariable('PAGE_TITLE', $page_title);	
	$template->setVariable('STYLE', $css);
	$template->setVariable('absRoot', $absRoot);
	//$template->setVariable('XAJAX_INIT', $xajax_directives);
		
#############################	
# render the index template #
#############################
	//$xajax->processRequests();	
	$template->show();		
?>
